package com.jr.bitcoin.request.service;

import com.alibaba.fastjson.JSONObject;
import com.jr.bitcoin.Constants;
import com.jr.bitcoin.bean.HotVideo;
import com.jr.bitcoin.bean.HotVideoCommon;
import com.jr.bitcoin.request.HttpUtils;

import java.util.List;


public class HotVideoService {
    /**
     *该方法用于获取热门数据，并将数据返回
     *
     */

    public static List<HotVideo> getHotVideo(){
        String url = Constants.TRIP_URL
                + "?key=" + Constants.TRTP_KEY
                + "&type=hot_video"
                +"&size = 20";
        String result = HttpUtils.get(url);



        //json解析
        HotVideoCommon videoCommon = JSONObject.parseObject(result, HotVideoCommon.class);

        System.out.println(videoCommon.result.size());
        return videoCommon.result;


    }
}
